import request from '../utils/request';

// 固定资产和流动资产管理相关API
export const assetApi = {
  // 获取固定资产列表
  getFixedAssets: (params) => {
    return request.get('/api/assets/fixed', { params });
  },

  // 获取固定资产详情
  getFixedAssetDetail: (id) => {
    return request.get(`/api/assets/fixed/${id}`);
  },

  // 创建固定资产
  createFixedAsset: (data) => {
    return request.post('/api/assets/fixed', data);
  },

  // 更新固定资产
  updateFixedAsset: (id, data) => {
    return request.put(`/api/assets/fixed/${id}`, data);
  },

  // 删除固定资产
  deleteFixedAsset: (id) => {
    return request.delete(`/api/assets/fixed/${id}`);
  },

  // 获取流动资产列表
  getCurrentAssets: (params) => {
    return request.get('/api/assets/current', { params });
  },

  // 获取流动资产详情
  getCurrentAssetDetail: (id) => {
    return request.get(`/api/assets/current/${id}`);
  },

  // 创建流动资产
  createCurrentAsset: (data) => {
    return request.post('/api/assets/current', data);
  },

  // 更新流动资产
  updateCurrentAsset: (id, data) => {
    return request.put(`/api/assets/current/${id}`, data);
  },

  // 删除流动资产
  deleteCurrentAsset: (id) => {
    return request.delete(`/api/assets/current/${id}`);
  },

  // 资产盘点
  assetInventory: (data) => {
    return request.post('/api/assets/inventory', data);
  },

  // 获取资产统计
  getAssetStatistics: (params) => {
    return request.get('/api/assets/statistics', { params });
  },

  // 资产调拨
  transferAsset: (id, data) => {
    return request.post(`/api/assets/${id}/transfer`, data);
  },

  // 资产维修
  repairAsset: (id, data) => {
    return request.post(`/api/assets/${id}/repair`, data);
  },

  // 资产报废
  scrapAsset: (id, data) => {
    return request.post(`/api/assets/${id}/scrap`, data);
  },

  // 获取资产分类
  getAssetCategories: () => {
    return request.get('/api/assets/categories');
  },

  // 创建资产分类
  createAssetCategory: (data) => {
    return request.post('/api/assets/categories', data);
  },

  // 更新资产分类
  updateAssetCategory: (id, data) => {
    return request.put(`/api/assets/categories/${id}`, data);
  },

  // 删除资产分类
  deleteAssetCategory: (id) => {
    return request.delete(`/api/assets/categories/${id}`);
  }
};
